//
//  ClientViewController.m
//  GoodsBTS
//
//  Created by onemade on 14-9-19.
//  Copyright (c) 2014年 CNPC. All rights reserved.
//

#import "ClientViewController.h"

@interface ClientViewController ()

@end

@implementation ClientViewController

-(void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DidEnterRegion" object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DidExitRegion" object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DidDetermineRegionState" object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:@"DidRangeBeacons" object:nil];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidDetermineRegionStateNotification:) name:@"DidDetermineRegionState" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidEnterRegionNotification:) name:@"DidEnterRegion" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidExitRegionNotification:) name:@"DidExitRegion" object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDidRangeBeaconsNotification:) name:@"DidRangeBeacons" object:nil];
}


- (void)handleDidDetermineRegionStateNotification:(NSNotification *)note {
//    GoodModel *good = note.userInfo[@"good"];
}

- (void)handleDidEnterRegionNotification:(NSNotification *)note {
//    GoodModel *good = note.userInfo[@"good"];

}

- (void)handleDidExitRegionNotification:(NSNotification *)note {
//    GoodModel *good = note.userInfo[@"good"];
    self.titleLabel.text = @"";
    self.titleLabel.placeholder = @"商品名称";
    self.markTextview.text = @"";
}

- (void)handleDidRangeBeaconsNotification:(NSNotification *)note {
    GoodModel *good = note.userInfo[@"good"];
    
    self.titleLabel.text = good.title;
    self.markTextview.text = good.mark;
//    self.prodcImageView.image = [UIImage imageNamed:good.title];
}



/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
